<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Complaint.Models.Dtos.Complaint>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <title>Edit a complaint</title>
    <meta name="description" content="icomplain edit a complaint" />
    <meta name="keywords" content="edit,complaint" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Edit your complaint against
        <%=Model.Organisation.Name %></h2>
    <% using (Html.BeginForm("Edit", "Complaint", FormMethod.Post, new { enctype = "multipart/form-data" }))
       {%>
    <%= Html.ValidationSummary(false) %>
    <p>
        Note: * marked are required fields.</p>
    <fieldset>
        <legend>Fields</legend>
        <p>
            <label for="Title">
                Title:</label>
            <em>*</em><%= Html.TextBox("Title", Model.Title, new { maxlength = 100 })%>
            <%= Html.ValidationMessage("Title", "Field required")%>
        </p>
        <p>
            <label for="Body">
                Body:</label><br />
            <span><em>*</em><%= Html.TextArea("Body", Model.Body, new { style = "width:95%;height:200px;" })%>
                <%= Html.ValidationMessage("Body", "Field required")%>
                Note: Max length is 8000 characters.</span>
        </p>
        <p>
            <label for="OrganisationRef">
                Organisation Ref:</label>
            <em>&nbsp;</em><%= Html.TextBox("OrganisationRef", Model.OrganisationRef, new { maxlength = 50 })%>
            <%= Html.ValidationMessage("OrganisationRef") %>
        </p>
        <p>
            <%  if (!string.IsNullOrEmpty(Model.Proof))
                {%>
            Proof:
            <%= Html.Encode(Model.Proof)%>
            <%  }
                else
                {%>
            <label for="Proof">
                Proof:</label>
            <em>&nbsp;</em><input type="file" name="Proof" id="Proof" />
            <%= Html.ValidationMessage("Proof")%>
            <%  } %>
        </p>
        <p>
            DateLodged:
            <%= Html.Encode(String.Format("{0:g}", Model.DateLodged)) %>
        </p>
        <p>
            <button id="save" class="formbutton">
                Save</button>
        </p>
    </fieldset>
    <% } %>
    <p>
        <%=Html.ActionLink("Back to List", "Index") %>
        |
        <%=Html.ActionLink("Back to Details", "Details", new {id = Model.ComplaintID}) %>
    </p>
</asp:Content>
